<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> 
<head> 
<title>Scuola Media E. d'Arborea - Lamarmora </title> 
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> 
<meta name="description" content="Il sito della scuola secondaria superiore di Iglesias, in Sardegna" /> 
<meta name="keywords" content="scuola, iglesias, didattica, insegnamento, docenti" /> 
<link rel="stylesheet" href="andreas08.css" type="text/css" media="screen,projection" />
<script type="text/javascript" src="/js/prototype.js"></script> 
<script src="/js/scriptaculous.js" type="text/javascript"></script>
<script type="text/javascript" src="/js/page.js"></script> 
<script type="text/javascript">
function new_hw(id, mod){
	if(mod == 0){
		alert("Compito non modificabile");
		return false;
	}
	act = window.open_centered("dettaglio_compito.php?t="+id, "aaa", 400, 300, "");
}
</script>
</head> 
 
<body> 
<div id="container" > 
 
<div id="header"> 
<h1>Scuola Media E. d'Arborea - Lamarmora</h1> 
<h2>area riservata ai docenti</h2> 
</div> 
 
<?php include "navigation.php" ?>
<div id="content"> 
<h2 style="text-align: center"><?php print "Classe ".$_SESSION['__classe__']->get_anno().$_SESSION['__classe__']->get_sezione()." - ".$_SESSION['__current_year__']->to_string() ?></h2> 

<?php 
if($res_act->num_rows < 1){
?>
<div style="width: 100%; margin-left: auto; margin-right: auto; margin-top: 40px; font-size: 12px; font-weight: bold; text-align: center">
Nessun compito assegnato.
</div>
<?php 
}
else{
?>
<table style="width: 100%; margin-left: auto; margin-right: auto" cellpadding="0" cellspacing="0">
	<tr>
		<td colspan="5" style="text-align: center; border-width: 1px 1px 1px 1px; border-style: solid; border-color: #c0c0c0; font-weight: bold; font-size: 12px">Compiti assegnati (<a href="<?php print $link ?>" style="font-weight: normal"><?php print $label ?></a>)</td>	
	</tr>
	<tr>
		<td style="width: 20%; text-align: center; font-weight: bold; border-width: 0px 0px 1px 1px; border-style: solid; border-color: #c0c0c0;">Per il...</td>
		<td style="width: 50%; text-align: center; font-weight: bold; border-width: 0px 1px 1px 1px; border-style: solid; border-color: #c0c0c0;">Compito</td>
		<td style="width: 10%; text-align: center; font-weight: bold; border-width: 0px 1px 1px 0px; border-style: solid; border-color: #c0c0c0;">Materia</td>
		<td style="width: 10%; text-align: center; font-weight: bold; border-width: 0px 1px 1px 0px; border-style: solid; border-color: #c0c0c0;">Assegnato</td>
		<td style="width: 10%; text-align: center; font-weight: bold; border-width: 0px 1px 1px 0px; border-style: solid; border-color: #c0c0c0;">Alunni</td>
	</tr>
<?php 
	$idx = 1;
	$bc = "";
	$data = "";
	while($dt = $res_dates->fetch_assoc()){
		if($idx > 1)
			print('<tr><td colspan="5" style="text-align: center; border-width: 0px 1px 1px 1px; border-style: solid; font-weight: bold; font-size: 12px;height: 10px; border-color: #c0c0c0;"></td></tr>');
		$sel_hw = "SELECT impegni.*, materie.materia AS mat FROM impegni, materie WHERE materie.id_materia = impegni.materia AND classe = ".$_SESSION['__classe__']->get_ID()." AND anno = ".$_SESSION['__current_year__']->get_ID()." AND data_inizio = '".$dt['data_inizio']."' AND impegni.tipo = 2 $teacher ORDER BY data_inizio DESC";
		//print $sel_hw;
		$res_hw = $db->execute($sel_hw);
		$rows = $res_hw->num_rows;
		$ct = 1;
		list($di, $oi) = explode(" ", $dt['data_inizio']);
		setlocale(LC_ALL, "it_IT");
		$giorno_str = strftime("%A", strtotime($di));
?>
	<tr>
		<td style="width: 20%; text-align: center; font-weight: normal; border-width: 0px 0px 1px 1px; border-style: solid; border-color: #c0c0c0;" rowspan="<?php print $rows ?>"><?php print $giorno_str." ". format_date($di, SQL_DATE_STYLE, IT_DATE_STYLE, "/")?></td>
<?php 
		while($hw = $res_hw->fetch_assoc()){
			$bc = "";
			if(($idx%2) != 0)
				$bc = "background-color: #e8eaec; ";
			list($da, $oa) = explode(" ", $hw['data_assegnazione']);
			$mod = 1;
			if($_SESSION['__user__']->getUid() != $hw['docente'])
				$mod = 0;
?>
		<?php if($ct > 1) print("<tr>") ?>
		<td style="<?php print $bc ?>width: 50%; text-align: center; font-weight: normal; border-width: 0px 1px 1px 1px; border-style: solid; border-color: #c0c0c0;"><a style="color: #303030; font-weight: normal" href="#" onclick="new_hw(<?php print $hw['id_impegno'] ?>, <?php print $mod ?>)"><?php print $hw['descrizione'] ?></a></td>
		<td style="<?php print $bc ?>width: 10%; text-align: center; font-weight: normal; border-width: 0px 1px 1px 0px; border-style: solid; border-color: #c0c0c0;"><?php print $hw['mat'] ?></td>
		<td style="<?php print $bc ?>width: 10%; text-align: center; font-weight: normal; border-width: 0px 1px 1px 0px; border-style: solid; border-color: #c0c0c0;"><?php print format_date($da, SQL_DATE_STYLE, IT_DATE_STYLE, "/")?></td>
		<td style="<?php print $bc ?>width: 10%; text-align: center; font-weight: normal; border-width: 0px 1px 1px 0px; border-style: solid; border-color: #c0c0c0;">Tutti</td>
	</tr>

<?php 
			$ct++;
			$idx++;
		}
	}
?>
</table>
<?php 
}
?>
<div style="width: 100%; margin-left: auto; margin-right: auto; margin-top: 40px; font-size: 12px; font-weight: bold; text-align: right">
<input type="button" value="Nuovo compito" onclick="new_hw(0)" style="margin-right: 0px; border: 1px solid #c0c0c0; font-size: 11px; padding: 5px" />
</div> 
<div class="splitcontentleft"> 

<p>&nbsp;</p>
 

</div> 
 
 
</div> 
 
<div id="subcontent"> 
<?php include 'smallbox.php'; ?>
 
<?php include "class_working.php" ?>


</div> 
 
<?php include "footer.php" ?>
 
</div> 
</body> 
</html>